﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Async="true" AsyncTimeout="120" Inherits="_Default" EnableViewState="false" EnableEventValidation="false" %>
<%@ Register tagname="UCCheck" tagprefix="uc" src="usercontrols/UCCheck.ascx" %>
<%@ Register tagname="UCNode" tagprefix="uc" src="usercontrols/UCNode.ascx" %>
<%@ Register tagname="UCTypeSimple" tagprefix="uc" src="usercontrols/UCTypeSimple.ascx" %>
<%@ Register tagname="UCTypeComplex" tagprefix="uc" src="usercontrols/UCTypeComplex.ascx" %>
<%@ Register tagname="UCPaging" tagprefix="uc" src="usercontrols/UCPaging.ascx" %>
<%@ Register tagname="UCData" tagprefix="uc" src="usercontrols/UCData.ascx" %>
<%@ Register tagname="UCDataView" tagprefix="uc" src="usercontrols/UCDataView.ascx" %>
<%@ Register tagname="Books" tagprefix="uc" src="pages/books/usercontrols/UCBooks.ascx" %>
<%@ Register tagname="Sections" tagprefix="uc" src="pages/sections/usercontrols/UCSections.ascx" %>
<%@ Register tagname="Chapters" tagprefix="uc" src="pages/chapters/usercontrols/UCChaptersPair.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Facebook To Ebook</title>
    <link type="text/css" href="css/tables.css?s1" rel=Stylesheet />
    <link type="text/css" href="css/paging.css" rel=Stylesheet />
    <link type="text/css" href="css/home.css" rel=Stylesheet />
    <style>
    </style>
    <meta property="og:title" content="Facebook To Ebook" />
    <meta property="og:description" content="Convert Facebook Posts to Ebook" />
    <meta property="og:image" content="https://bookprinting.com/images/resources/ebook-file-types.jpg" />
</head>
<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
      FB.init({
          appId: '1916464281903142',
      xfbml      : true,
      version    : 'v2.9'
    });-

      // ADD ADDITIONAL FACEBOOK CODE 

      /*
    FB.login(function (response) {
        // handle the response
    }, { scope: 'email,user_likes' });
    */

  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>
<style>
    table.tight td {
        padding: 0px 4px;
    }
</style>

<h1 id="fb-welcome"></h1>


    <form id="form1" runat="server">
    <div id="plhAll" runat="server">
        <asp:Literal ID=lit runat=server />

        <div style="margin-left:10px; margin-bottom:25px">
        <asp:Menu ID="menu" runat="server" 
            OnMenuItemClick="menu_Click" Orientation="Horizontal" 
            ClientIDMode="AutoID">
            <StaticMenuItemStyle CssClass="menu_normal"   />
            <DynamicMenuItemStyle CssClass="menu_normal" />
            <StaticSelectedStyle CssClass="menu_selected" />
            <DynamicSelectedStyle CssClass="menu_selected" />
            <Items>
                <asp:MenuItem Value="0" Text="Home" />
                <asp:MenuItem Value="1" Text="Books"  />
                <asp:MenuItem Value="2" Text="Security" />
                <asp:MenuItem Value="3" Text="Changes" />
                <asp:MenuItem Value="4" Text="Data" />
                <asp:MenuItem Value="5" Text="Checks" />
                <asp:MenuItem Value="6" Text="Members" />
                <asp:MenuItem Value="7" Text="Types" />
                <asp:MenuItem Value="8" Text="Tags" />
                <asp:MenuItem Value="9" Text="Photos" />
                <asp:MenuItem Value="10" Text="Repeats" />
            </Items>
        </asp:Menu>
        </div>        

        <asp:MultiView runat="server" ID="mv" ActiveViewIndex="0" >

            <asp:View runat="server" id="vIntro">
                <div class="box" width="300px">
                    <strong>Facebook-to-eBook</strong><br />

                    Organise/Export Your Posts As E-Books (htm/epub) <br />                        
                    <hr />
                    <asp:Hyperlink id="lnkName" runat="server"/>    <asp:Label ID=litCounts runat=server Font-Size=Smaller  />

					<asp:PlaceHolder ID=plhHide runat=server Visible=false>
						<asp:CheckBox id=chkMoreFrequent  Font-Italic=true AutoPostBack=true runat=server Text="Monitor every 5mins" Enabled=false /> &nbsp; <a id=lnkFrequent runat=server title="Monitor your links more frequently (every 5mins instead of every day)"  href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RSKLGV6SE7FYW&custom=">Frequent ($20)</a><br>
					</asp:PlaceHolder>  

                    <hr />
                    <table style="margin-top:10px; margin-bottom:10px" cellpadding=0 cellspacing=0>
                        <tr>
                            <td style="padding-right:10px" id="colPaypal" runat="server" Visible="False"><asp:HyperLink ToolTip="Make a Donation" Target=_blank ID=lnkDonateImg runat=server NavigateUrl="http://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L9WTD5VGT6TTJ&custom=" ><asp:Image Height=20 ID=imgDonate runat=server ImageUrl="~/images/donate.png" /></asp:HyperLink> </td>
                            <td title="Like or Share this Application" width="100">
                                <div class="fb-like" data-href="http://apps.facebook.com/ebookgen/" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div>
                            </td>
                            <td>
                                <a target="_blank" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fapps.facebook.com%ebookgen%2F">
                                Share</a> &nbsp; <a style="display:none" id=lnkDonate runat=server target=_blank>free service</a><br />
                            </td>
                        </tr>
                    </table>

                </div>


            </asp:View>

            <asp:View ID="vBook" runat="server">

                <div style="margin:10px;">
                    <strong>
                        <asp:HyperLink ID="lnkBooks" runat="server" Text="My Books" NavigateUrl="~/?bookId=0" style="margin-left:10px; margin-right:5px" ForeColor="Black" /> 
                        <asp:Literal ID="litSpacer1" runat="server" Text="|" Visible="false" />
                        <asp:HyperLink Visible="false" ID="lnkBook" runat="server" Text="Book" NavigateUrl="~/?bookId=0" style="margin:0px 5px" ForeColor="Black" />
                    </strong>
                        <asp:DropDownList Visible="false" ID="ddBook" runat="server" AutoPostBack="true" style="margin:0px 5px" OnSelectedIndexChanged="ddBook_SelectedIndexChanged" />
                        <strong><asp:Literal ID="litSpacer2" runat="server" Text="|" Visible="false" /></strong>
                        <asp:DropDownList Visible="false" ID="ddSection" runat="server" AutoPostBack="true" style="margin:0px 5px" OnSelectedIndexChanged="ddSection_SelectedIndexChanged" />
                </div>
                <hr />

                <div style="width:500px; margin-left:20px;" id="divBooks" runat="server">
                    <uc:Books ID="ctrlBooks" runat="server" />

                    <asp:PlaceHolder ID="plhNewBook" runat="server">
                        <asp:TextBox ID="txtNewBook" runat="server" />
                        <asp:Button ID="btnNewBook" runat="server" Text="New Book" />
                    </asp:PlaceHolder>
                </div>


                <DIV style="width:600px; margin:20px" id="fs" runat="server" visible="false">

                    <div class="box" style="margin:20px 0px; width:500px">
                        <strong>Title:</strong>
                        <asp:TextBox ID="txtBookName" runat="server" /> 
                        <asp:Button ID="btnUpdateBookName" runat="server" Text="Update" OnClick="btnUpdateBookName_Click" />
                        <asp:Button ID="btnCloneBook" runat="server" Text="Clone" OnClientClick="return confirm('Clone?')" OnClick="btnCloneBook_Click" />
                        <asp:Button ID="btnPublish" runat="server" Text="Publish" OnClientClick="return confirm('Publish?')" onclick="btnPublish_Click" />

                        &nbsp;
                        <asp:HyperLink ID="lnkPreview" runat="server" Text="Preview&raquo;" Target="_blank" />
                        &nbsp;
                        <asp:HyperLink ID="lnkExport" runat="server" Target="_blank" Text="Download&raquo;" />
                        &nbsp;
                        <asp:HyperLink ID="lnkExportNoImg" runat="server" Target="_blank" Text="No Img&raquo;" />
                    </div>
                    
                    <div style="margin-bottom:-10px">
                        <strong>Sections:</strong>
                        <uc:Sections ID="ctrlSections" runat="server" />
                    </div>

                    <div id="plhNewSection" runat="server">
                        <asp:TextBox ID="txtNewSections" runat="server" />
                        <asp:Button ID="btnNewSections" runat="server" Text="New Section" OnClick="btnNewSections_Click" />
                    </div>
                </DIV>
                
                <DIV  style="width:600px; margin:20px" id="fsSection" runat="server" visible="false">                    
                    <div class="box" style="margin:20px 0px; white-space:nowrap; width:500px">
                        <strong>Section:</strong>
                        <asp:TextBox ID="txtSectionName" runat="server" />
                        <asp:Button ID="btnUpdateSectionName" runat="server" Text="Update" OnClick="btnUpdateSectionName_Click" />
                        &nbsp;
                        <asp:HyperLink ID="lnkPreviewSection" runat="server" Text="Preview&raquo;" Target="_blank" />
                        <asp:TextBox ID="txtTagSection" runat="server" Width="100" /><asp:Button ID="btnTagSection" runat="server" Font-Size="Smaller" Text="Tag All" OnClick="btnTagSection_Click" />
                    </div>

                    <div style="margin:10px 0px">
                        <uc:Chapters ID="ctrlChapters" runat="server" />
                    </div>
                </DIV>

                <asp:Panel Visible="false" ID="plhPreview" runat="server" style="margin:20px;">
                    <strong>Preview:</strong>
                    <br />
                    <iframe width="800" height="600" id="iframe" runat="server">

                    </iframe>
                </asp:Panel>
            </asp:View>


            <asp:View runat="server" id="vSecurity">
                <div class="box" style="width:300px">
                    <strong>Access Tokens</strong>
                    <ol style="margin-bottom:0px">
                        <li>
                            Automatic (Pending Approval)
                        </li>
                        <li>Upload Zip (Feature pending)</li>
                        <li>
                            Debug Token (Paste Below)
                        </li>
                    </ol>
                    <ul style="margin-left:15px; font-size:smaller; margin-top:0px">
                        <li>Use 
                            <asp:HyperLink ID="lnk" runat="server" Target="_blank"
                                Text="This Page"
                                NavigateUrl="https://developers.facebook.com/tools/explorer/145634995501895/" />                                     
                            to generate a token</li>
                        <li>
                            Click on "Get Token" (top-right)
                        </li>
                        <li>
                            Select "Get User Access Token"
                        </li>
                        <li>
                            Tick Most Boxes, click "Get Access Token" button
                        </li>
                    </ul>
                    <asp:TextBox ID="txtToken" runat="server" Font-Size="Smaller" />
                    <asp:Button ID="btnToken" runat="server" Text="Set Token" OnClick="btn_Click" /><br />
                    <br />
                    <asp:Button ID="btnExecute" runat="server" Text="Run Script" OnClick="btnExecute_Click" />
                    <hr />
                    <b>Import Private Messages</b><br />
                    <asp:FileUpload ID="fuMsg" runat="server" /> <asp:Button ID="btnImportMsg" runat="server" Text="Import Messages.htm" OnClick="btnImportMsg_Click" />
                    <div><asp:Label ID="lblImportMsg" runat="server" EnableViewState="false" /></div>
                </div>
                <asp:Panel Visible="false" ID="pnlIframe" runat="server" style="margin:20px;" EnableViewState="false">
                    <strong>Running:</strong>
                    <br />
                    <iframe width="800" height="600" id="iframeScript" runat="server">

                    </iframe>
                </asp:Panel>
            </asp:View>
            
            
            
            <asp:View runat="server" id="vChanges">


        <table  align=left cellpadding=0 cellspacing=0>
            <tr>
                <td valign=top id=colRecentAdds runat=server>

                    <asp:PlaceHolder id=colRecentDeletes runat=server >
                        <table  class=datagrid title="Deleted Recently">
                            <tr>
                                <th colspan=3>Deleted Recently  <span style="font-weight:normal" >(<asp:Literal ID=litDeletedCount runat=server />)</span> </th>
                            </tr>
                            <asp:PlaceHolder ID=plhDeleted runat=server />
                            <uc:UCPaging id=ctrlPagingDeletes runat=server PageSize="20" QueryString=p2 />
                        </table>
                        <br /><br />
                    </asp:PlaceHolder>

                    <table class=datagrid title="Added Recently">
                        <tr>
                            <th colspan=3>Added Recently <span style="font-weight:normal" >(<asp:Literal ID=litAddedCount runat=server />)</span> </th>
                        </tr>
                        <asp:PlaceHolder ID=plhAdded runat=server />
                    </table>
                    <uc:UCPaging id=ctrlPagingAdded runat=server PageSize="20" QueryString=p1 />

                </td>
                <td valign=top id=colUpdates runat=server style="padding-left:40px">

                    <table class=datagrid title="Updated Recently">
                        <tr>
                            <th colspan=3>Changed Recently: <span style="font-weight:normal" >(<asp:Literal ID=litUpdatedCount runat=server />)</span> </th>
                        </tr>
                        <asp:PlaceHolder ID=plhUpdates runat=server />
                    </table>
                     <uc:UCPaging id=ctrlPagingUpdates runat=server PageSize="20" QueryString=p3 />

                </td>
			</tr>
		</table>

            </asp:View>



            <asp:View runat="server" id="vData">
                <uc:UCData      id="ctrlData"     runat="server" visible="false" />
                <uc:UCDataView  id="ctrlDataView" runat="server" visible="false" />
            </asp:View>

 

            <asp:View runat="server" id="vLog">

                    
                    <table class=datagrid title="You must check this page every 60 days, otherwise the app will lose access to your data">
                        <tr>
                            <th>Started</th>
                            <th>Elapsed</th>
                            <th>API</th>
                            <th>IUD</th>
                            <th> 
                                <asp:Button ID="btnDeleteLogs" runat="server" Text="Delete Logs" Font-Size="Smaller" OnClick="btnDeleteLogs_Click" /> 
                                Since: <asp:Label ID=lblFirstCheck runat=server />
                            </th>
                        </tr>
                        <asp:PlaceHolder ID=plhChecks runat=server />
                    </table>
                    <uc:UCPaging id=ctrlPagingChecks runat=server PageSize="20" QueryString=p5 />
            </asp:View>



            <asp:View runat="server" id="vAdmin">


        <table cellpadding=0 cellspacing=0>
			<tr>
                <td valign=top id=colAdmin runat=server visible=false  style="padding-left:40px">
                    <table class=datagrid title="You must check this page every 60 days, otherwise the app will lose access to your data">
                        <tr>
                            <th colspan=3>New Members (<asp:Label ID=litNewMemberCount runat=server />)</span> </th>
                        </tr>
                        <asp:PlaceHolder ID=plhNewMembers runat=server />
                    </table>
                    <uc:UCPaging id=ctrlPagingNewMem runat=server PageSize="20" QueryString=p6 />
                </td>
            </tr>
        </table>


            </asp:View>


            <asp:View runat="server" id="vTypes">


        <table  align=center cellpadding=0 cellspacing=0>
			<tr>
                <td valign=top>
                    <table class=datagrid title="Manually Added">
                        <tr>
                            <th> Manual/API</th>
                            <th>Tags (Format)</th>
                        </tr>						
                        <asp:PlaceHolder ID=plhManual runat=server />
                        <tr>
                            <th>Discovered/Auto</th>
                            <th>Tags (Format)</th>
                        </tr>						
                        <asp:PlaceHolder ID=plhAuto runat=server />
                    </table>
                </td>
                <td width="50">
                    &nbsp;
                </td>
                <td valign=top>
                    <table class=datagrid title="System Types">
                        <tr>
                            <th>System </th>
                            <th>Signatures</th>
                            <th>Usage</th>
                        </tr>						
                        <asp:PlaceHolder ID=plhSystem runat=server />
                    </table>
                </td>
            </tr>
        </table>

            </asp:View>


            
            <asp:View runat="server" id="viewTags">
                <div>
                <asp:Table ID="tblTagType" runat="server" CssClass="datagrid" style="margin-left:20px">
                    <asp:TableHeaderRow>
                        <asp:TableHeaderCell>Tag Type</asp:TableHeaderCell>
                        <asp:TableHeaderCell>Select</asp:TableHeaderCell>
                    </asp:TableHeaderRow>
                    <asp:TableRow>
                        <asp:TableCell>
                            <asp:TextBox ID="txtTypeName" runat="server" Width="100" Font-Size="Smaller" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:Button ID="btnSaveTypeName" runat="server" Text="Save" Font-Size="Smaller" OnClick="btnSaveTypeName_Click" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
                </div>
                
                <div style="max-height:600px; overflow:auto; width:390px">
                    <asp:Table ID="tblTags" runat="server" CssClass="datagrid tight" style="margin-left:20px; border-collapse:collapse; width:350px" CellPadding="2" CellSpacing="0" border="1">
                        <asp:TableHeaderRow>
                            <asp:TableHeaderCell>Tag</asp:TableHeaderCell>
                            <asp:TableHeaderCell>Img</asp:TableHeaderCell>
                            <asp:TableHeaderCell>Post</asp:TableHeaderCell>
                            <asp:TableHeaderCell>Alb</asp:TableHeaderCell>
                        </asp:TableHeaderRow>
                    <asp:TableRow>
                        <asp:TableCell>
                            <asp:TextBox ID="txtTag" runat="server" Width="100" Font-Size="Smaller" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:Button ID="btnRenameTag" runat="server" Text="Save" Font-Size="Smaller" OnClick="btnRenameTag_Click" />
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:Button ID="btnDeleteTag" runat="server" Text="Del" Font-Size="Smaller" OnClick="btnDeleteTag_Click" OnClientClick="return confirm('Delete tag?')" /><br />
                        </asp:TableCell>
                    </asp:TableRow>
                    </asp:Table>
                </div>
            </asp:View>
            <asp:View runat="server" id="viewPhotosRedirect" />
            <asp:View runat="server" id="viewRepeatsRedirect" />
        </asp:MultiView>

    </div>
    </form>
</body>
</html>
